<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-12-19 10:04:20
 * @LastEditors: 刘佳欢 2173558681@qq.com
 * @LastEditTime: 2025-09-28 08:47:07
-->
<!-- <template>
  <div>
    学生列表
    <el-button @click="toDetails">详情</el-button>
  </div>
</template>
<script>
export default {
  methods:{
    toDetails(){
      this.$router.push({
        path:"/sc/student/Details",
        query:{id:1}
      })
    }
  }
}
</script> -->

<template>
  <div>
    <h3>学生列表</h3>
    <el-table :data="studentList" border style="width: 100%">
      <el-table-column prop="id" label="ID"></el-table-column>
      <el-table-column prop="no" label="学号"></el-table-column>
      <el-table-column prop="name" label="姓名"></el-table-column>
      <el-table-column prop="gender" label="性别"></el-table-column>
      <el-table-column prop="telephone" label="电话"></el-table-column>
      <el-table-column prop="birth" label="生日"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
            type="text"
            @click="handleViewDetails(scope.row.id)"
          >查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="page"
      :page-sizes="[5, 8, 10, 15]"
      :page-size="pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      studentList: [
        {
          id: 1,
          no: "2308300046",
          name: "刘佳欢",
          gender: "女",
          telephone: "13800138001",
          birth: "2000-01-01",
        },
        {
          id: 2,
          no: "2308300002",
          name: "宋佳馨",
          gender: "女",
          telephone: "13800138002",
          birth: "2000-02-02",
        },
        {
          id: 3,
          no: "2308300029",
          name: "崔凤瑶",
          gender: "女",
          telephone: "13800138003",
          birth: "2000-03-03",
        },
      ],
      page: 1,
      pageSize: 10,
      total: 3,
    };
  },
  methods: {
    handleSizeChange(val) {
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      this.page = val;
    },
    handleViewDetails(id) {
      this.$router.push({
        path: "/sc/student/Details",
        query: { id: id },
      });
    },
  },
};
</script>